home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / alaskan-adversary.swf / scripts / frame_29 / PlaceObject3_803_210 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2008-09-11  |  8.4 KB  |  244 lines

  1. onClipEvent(enterFrame){
  2.    _root.char._x += speed;
  3.    bridgeSFX = new Sound(this);
  4.    bridgeSFX.attachSound("bridge");
  5.    if(_root.paus3)
  6.    {
  7.       speed = 0;
  8.       maxspeed = 0;
  9.    }
  10.    if(!_root.paus3)
  11.    {
  12.       grav++;
  13.       _Y = _Y + grav;
  14.       while(_root.ground.hitTest(_X,_Y,true))
  15.       {
  16.          _Y--;
  17.          grav = 0;
  18.       }
  19.       if(this._currentframe != 45)
  20.       {
  21.          if(Key.isDown(_global.rightkey) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30)
  22.          {
  23.             _xscale = scale;
  24.             speed++;
  25.             if(speed >= maxspeed)
  26.             {
  27.                speed = maxspeed;
  28.             }
  29.             if(_root.ground.hitTest(_X,_Y + 7,true))
  30.             {
  31.                this.gotoAndStop("run");
  32.             }
  33.          }
  34.          else if(Key.isDown(_global.leftkey) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30)
  35.          {
  36.             _xscale = - scale;
  37.             speed--;
  38.             if(speed <= maxspeed * -1)
  39.             {
  40.                speed = maxspeed * -1;
  41.             }
  42.             if(_root.ground.hitTest(_X,_Y + 7,true))
  43.             {
  44.                this.gotoAndStop("run");
  45.             }
  46.          }
  47.          else
  48.          {
  49.             if(speed > 0)
  50.             {
  51.                speed--;
  52.                if(speed <= 0)
  53.                {
  54.                   speed = 0;
  55.                }
  56.             }
  57.             else if(speed < 0)
  58.             {
  59.                speed++;
  60.                if(speed >= 0)
  61.                {
  62.                   speed = 0;
  63.                }
  64.             }
  65.             if(_root.ground.hitTest(_X,_Y + 3,true) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30 && this._currentframe != 50)
  66.             {
  67.                this.gotoAndStop("idle");
  68.             }
  69.          }
  70.          if(_root.fallDeath.hitTest(_X,_Y,true))
  71.          {
  72.             _root.sfx.gotoAndStop("fallDeath");
  73.             _global.deathtype = 1;
  74.             this.gotoAndPlay("fall");
  75.          }
  76.          if(this.hitTest(_root.lvl1bound))
  77.          {
  78.             _root.gotoAndStop("level1-mini");
  79.             _root.camera.gotoAndStop("fader");
  80.          }
  81.          if(this._currentframe != 25 && this._currentframe != 30)
  82.          {
  83.             damaged = 0;
  84.          }
  85.          if(_root.death.hitTest(_X,_Y,true))
  86.          {
  87.             _root.gotoAndStop("death");
  88.          }
  89.          if(_root.bridgeBeam.hitboxBridge.hitTest(_root.char.hitboxLevel))
  90.          {
  91.             _root.arrowHelp.gotoAndStop(2);
  92.          }
  93.          if(_root.bridgeBeam.hitboxBridge2.hitTest(_root.char.hitboxLevel))
  94.          {
  95.             _root.arrowHelp.gotoAndStop(2);
  96.             _root.bridgeBeam.gotoAndPlay(2);
  97.             _root.ground.gotoAndPlay(2);
  98.          }
  99.          if(Key.isDown(p) || Key.isDown(_global.esc) && !paus3)
  100.          {
  101.             _root.pauseMenu.gotoAndStop(5);
  102.             _root.paus3 = 1;
  103.          }
  104.          if(Key.isDown(_global.upkey) && _root.ground.hitTest(_X,_Y + 7,true) || _root.ground2.hitTest(_X,_Y + 7,true) && grav <= 4)
  105.          {
  106.             grav = - jumpHeight;
  107.             _Y = _Y - 4;
  108.             this.gotoAndStop("jump");
  109.             if(_root.sfxjc._currentframe <= 20)
  110.             {
  111.                _root.sfx.gotoAndPlay("jump1");
  112.             }
  113.             if(_root.sfxjc._currentframe >= 20)
  114.             {
  115.                _root.sfx.gotoAndPlay("jump2");
  116.             }
  117.          }
  118.          attackFrame = ["attack_1","attack_2"];
  119.          attack = 0;
  120.          if(!Key.isDown(_global.rightkey) && !Key.isDown(_global.leftkey) && !Key.isDown(_global.upkey) && !jumping && !attack)
  121.          {
  122.             if(this._currentframe != 10 && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40)
  123.             {
  124.                if(Key.isDown(_global.z) || Key.isDown(_global.spc))
  125.                {
  126.                   _root.char.gotoAndStop(attackFrame[random(attackFrame.length)]);
  127.                   attack = 1;
  128.                }
  129.                if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box) && _root.box._currentframe != 10 && this._currentframe != 40)
  130.                {
  131.                   _root.char.gotoAndStop("kick");
  132.                   attack = 1;
  133.                }
  134.                if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box2) && _root.box2._currentframe != 10 && this._currentframe != 40)
  135.                {
  136.                   _root.char.gotoAndStop("kick");
  137.                   attack = 1;
  138.                }
  139.                if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box3) && _root.box3._currentframe != 10 && this._currentframe != 40)
  140.                {
  141.                   _root.char.gotoAndStop("kick");
  142.                   attack = 1;
  143.                }
  144.                if(Key.isDown(_global.z || _global.spc) && Key.isDown(_global.spc) && this.hitboxKick.hitTest(_root.box4) && _root.box4._currentframe != 10 && this._currentframe != 40)
  145.                {
  146.                   _root.char.gotoAndStop("kick");
  147.                   attack = 1;
  148.                }
  149.             }
  150.             if(this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40)
  151.             {
  152.                attack = 0;
  153.             }
  154.          }
  155.          if(!attack && this._currentframe != 10 && this._currentframe != 50 && this._currentframe != 15 && this._currentframe != 40 && _root.camera.specialBar._currentframe == 5 && !Key.isDown(_global.rightkey) && !Key.isDown(_global.leftkey))
  156.          {
  157.             if(Key.isDown(_global.a))
  158.             {
  159.                this.gotoAndStop("special");
  160.                attack = 1;
  161.                _root.camera.specialBar.gotoAndStop(1);
  162.                _global.fucker = 0;
  163.             }
  164.          }
  165.       }
  166.       wallsLeft = 10;
  167.       i = 1;
  168.       while(i <= wallsLeft)
  169.       {
  170.          wallLeft = _root["wallLeft" + i];
  171.          if(Key.isDown(37))
  172.          {
  173.             if(wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height / 2,true) || wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height / 6,true) || wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height,true))
  174.             {
  175.                speed = 0;
  176.             }
  177.          }
  178.          i++;
  179.       }
  180.       wallsRight = 10;
  181.       i = 1;
  182.       while(i <= wallsRight)
  183.       {
  184.          wallRight = _root["wallRight" + i];
  185.          if(Key.isDown(39))
  186.          {
  187.             if(wallRight.hitTest(_X + _width / 2 + ex,_Y - _height / 2,true) || wallRight.hitTest(_X + _width / 2 + ex,_Y - _height / 6,true) || wallRight.hitTest(_X + _width / 2 + ex,_Y - _height,true))
  188.             {
  189.                speed = 0;
  190.             }
  191.          }
  192.          i++;
  193.       }
  194.       tuska = 25;
  195.       i = 1;
  196.       while(i <= tuska)
  197.       {
  198.          tusk = _root["tusk" + i];
  199.          if(this.hitTest(tusk))
  200.          {
  201.             tusk.gotoAndStop(7);
  202.             _global.score += 1;
  203.             if(_global.sounds == 1)
  204.             {
  205.                tuskPickup = new Sound(this);
  206.                tuskPickup.attachSound("tuskPickup");
  207.                tuskPickup.start();
  208.             }
  209.          }
  210.          i++;
  211.       }
  212.       tuskb = 25;
  213.       i = 1;
  214.       while(i <= tuskb)
  215.       {
  216.          clump = _root["clump" + i];
  217.          if(this.hitTest(clump))
  218.          {
  219.             clump.gotoAndStop(10);
  220.             _global.score += 5;
  221.             if(_global.sounds == 1)
  222.             {
  223.                tuskPickup = new Sound(this);
  224.                tuskPickup.attachSound("tuskPickup");
  225.                tuskPickup.start();
  226.             }
  227.          }
  228.          i++;
  229.       }
  230.       if(_root.ground.hitTest(_X + _width / 2 + ex,_Y - _height / 4,false) || _root.ground.hitTest(_X + _width / 2 + ex,_Y - _height / 12,false) || _root.ground.hitTest(_X + _width / 4 + ex,_Y - _height,false))
  231.       {
  232.          _X = _X - speed;
  233.       }
  234.       if(_root.ground.hitTest(_X - _width / 2 - ex,_Y - _height / 4,false) || _root.ground.hitTest(_X - _width / 2 - ex,_Y - _height / 12,false) || _root.ground.hitTest(_X - _width / 4 - ex,_Y - _height,false))
  235.       {
  236.          _X = _X + speed;
  237.       }
  238.       if(grav >= 5)
  239.       {
  240.          this.gotoAndStop("fall2");
  241.       }
  242.    }
  243. }
  244.